class HelloBase(type):

    def __new__(cls, name, bases, attrs, **kwargs):
        print(
            f'cls={cls}, name={name}, bases={bases}, attrs={attrs}, kwargs={kwargs}')
        meta = attrs.get('Meta', None)
        new_class = super().__new__(cls, name, bases, attrs, **kwargs)
        setattr(new_class, '_meta', meta)
        return new_class


# cls=<class '__main__.HelloBase'>, name=Hello, bases=(), attrs={'__module__': '__main__', '__qualname__': 'Hello'}, kwargs={}
class Hello(metaclass=HelloBase):
    pass


# cls=<class '__main__.HelloBase'>, name=H, bases=(<class '__main__.Hello'>,), attrs={'__module__': '__main__', '__qualname__': 'H', 'Meta': <class '__main__.H.Meta'>}, kwargs={}
class H(Hello):

    class Meta:
        db_table = 'hello'


print(H._meta)
print(H._meta.db_table)
